﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Input;
using System.Collections.Generic;
using System.Windows.Media;

namespace ThuPhap.Models
{
    public class FontFamilyManage 
    {
        private string fontName;

        public string FontName
        {
            get { return fontName; }
            set
            {
                if (value != fontName)
                {
                    fontName = value;
                }
            }
        }

        private FontFamily fontFamily;

        public FontFamily FontFamily
        {
            get { return fontFamily; }
            set
            {
                if (value != fontFamily)
                {
                    fontFamily = value;
                }
            }
        }

        //public List<FontFamilyManage> Load()
        //{
        //    //var allFonts = App.Current.Resources.Keys;

        //    var allFonts = App.Current.Resources.Keys;
        //    List<string> allFontKeys = new List<string>();
        //    foreach (var item in allFonts)
        //    {
        //        var name = item as string;
        //        if (name.Contains("Font_") == true)
        //        {
        //            allFontKeys.Add(name);
        //        }
        //    }
        //    List<FontFamilyManage> listResults = new List<FontFamilyManage>();
        //    var resources = Application.Current.Resources;
        //    foreach (var item in allFontKeys)
        //    {
        //        FontFamily fontFamily = resources[item] as System.Windows.Media.FontFamily;
        //        string source = fontFamily.Source;
        //        FontFamilyManage font = new FontFamilyManage()
        //        {
        //            FontName = source.Substring(source.IndexOf("#")+1),
        //            FontFamily = fontFamily
        //        };

        //        listResults.Add(font);
        //    }
        //    return listResults;
        //}
    }
}
